Dynomotion

Group: DynoMotion Message: 7306 From: az9633@ymail.com Date: 4/20/2013
Subject: Kcnc G code program looping
Hello:

If I end a G code program with an M30 and no M2 will it loop to the beginning and continue running without pushing "progam start" again?

If so, is there a way to effectively stop the program execution gracefully upon activation of in Input from the Kflop I/O?


Or: Can I pass an integer parameter from the G code screen through to a C program?


In Kcnc I want to have a continuous looping program that calls a C program where the operator is able to set a dwell time from the Kcnc progam screen. This would be like a G code dwell or "DelaySec()" command. I would also want to break out of the loop and stop the G program upon seeing an I/O bit.


G code flow example:

G4 dwell
M04 (Includes a C prog call plus if an input is active then stops the G code execution and resets G code program pointer.)
M30 (loop back to top)

Thank You,

AZ
Group: DynoMotion Message: 7307 From: Neil Date: 4/20/2013
Subject: Re: Kcnc G code program looping
--- In DynoMotion@yahoogroups.com, "az9633@..." <az@...> wrote:
>
> Hello:
>
> If I end a G code program with an M30 and no M2 will it loop to the beginning and continue running without pushing "progam start" again?
>
> If so, is there a way to effectively stop the program execution gracefully upon activation of in Input from the Kflop I/O?
>
>
> Or: Can I pass an integer parameter from the G code screen through to a C program?
>
>
> In Kcnc I want to have a continuous looping program that calls a C program where the operator is able to set a dwell time from the Kcnc progam screen. This would be like a G code dwell or "DelaySec()" command. I would also want to break out of the loop and stop the G program upon seeing an I/O bit.
>
>
> G code flow example:
>
> G4 dwell
> M04 (Includes a C prog call plus if an input is active then stops the G code execution and resets G code program pointer.)
> M30 (loop back to top)
>
> Thank You,
>
> AZ
>
I am not up with Kcnc, but I always thouht M30 went back to the start of the program, and is ready, waiting for cycle start again.
I believe you are getting noise on your cycle start input line.
Continuous interference on the cycle start line might not be immediately obvious if the program always runs to the end without a pause.
Try a small program that does something, and has M0s in the program that require the program to wait for cycle start. It probably goes right past it. Make the lines preceding the the M0 similar to what the end of a program looks like. ie. motorstop, coolant off etc.
Group: DynoMotion Message: 7313 From: az@aimele.com Date: 4/21/2013
Subject: Re: Kcnc G code program looping
Neil:

Thank you for your reply but you misunderstand.  I want the program to loop back and run without a cycle start but be able to stop the program gracefully so I don't have to push E stop and reinitialize the machine.

AZ



Group: DynoMotion Message: 7314 From: Neil Date: 4/22/2013
Subject: Re: Kcnc G code program looping
OK. You can put your program in a subroutine and call a ridiculous amount of times. At the end of the subroutine, before the M99 (return) put M1.
With M98 the L (loop) value can be made rather large.
Turn on optional stop and the subroutine won't return and stops in an orderly manner.
This is just one of many ways to do what you want.
If you have a hardwired optional stop switch this would work OK and not even require a screen input.
Bozo could turn off the switch at lunch time, have lunch.
After lunch, turn it back on, and hit cycle start.

--- In DynoMotion@yahoogroups.com, "az@..." <az@...> wrote:
>
> Neil:
>
> Thank you for your reply but you misunderstand. I want the program to loop back and run without a cycle start but be able to stop the program gracefully so I don't have to push E stop and reinitialize the machine.
>
> AZ
>
>
>
>
Group: DynoMotion Message: 7318 From: Tom Kerekes Date: 4/22/2013
Subject: Re: Kcnc G code program looping
Hi AZ,

Could the Operator just edit the Dwell in the Gcode?

One idea might be to add an MCode at the end of the program that would issue a Cycle Start (or maybe a HALT, Restart, Cycle Start) conditionally based on an input bit.

See the example to have KFLOP send commands to the PC (KMotionCNC) :

KFLOPtoPCCmdExamples.c

Regards
TK